package ink.metoo.gude.module.security.domain

import ink.metoo.gude.module.security.domain.ddl.User
import org.springframework.security.core.userdetails.UserDetails

class SimpleUserDetails(val user: User) : UserDetails {

    // call getRoles() to initialize roles
    private val authorities = user.roles.map { SimpleGrantedAuthority(it) }

    override fun getAuthorities() = authorities

    override fun getPassword() = user.password

    override fun getUsername() = user.email


}